#ifndef THREAD_POOL_H
#define THREAD_POOL_H

#include "TaskQueue.h"
#include "Task.h"
#include <vector>
#include <thread>
#include <memory>

using std::function;
using std::thread;
using std::unique_ptr;
using std::vector;

class ThreadPool
{
private:
    bool _isRunning;
    size_t _poolSize;
    size_t _taskSize;
    vector<thread> _threads;
    TaskQueue _tasks;

private:
    void init();
    static void threadFunc(ThreadPool *);

public:
    ThreadPool(size_t poolSize = 10, size_t taskSize = 20);
    ~ThreadPool();
    void addTask(Task *);
    Task *getTask();
    void shutdown();
};

#endif